#@bootStrapLayout("商户管理信息界面-xxxx管理")

#define bootStrapMain()
<div class="container">
    #include("../../common/header.html")
    <div class="col-md-12">
        <ol class="breadcrumb">
            <li><a href="#">主页</a></li>
            <li class="active">XXX管理</li>
            <li></li>
        </ol>
        <a href="/travel/receiver/add">+添加</a>
    </div>
    <div class="col-md-12">
        <div style="text-align: center;margin:15px;">
            <form class="form-inline">

                <div class="form-group">
                    <label for="title">文章标题：</label>
                    <input type="text" class="form-control" id="title" placeholder="请输入文章标题...">
                </div>
                <button type="button" id="searchBtn" class="btn btn-default">点我检索</button>
            </form>
        </div>
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th></th>
                <th>创建时间</th>
                <th>更新时间</th>
                <th>详情地址</th>
                <th>省</th>
                <th>市</th>
                <th>区</th>
                <th>状态</th>
                <th>是否为默认</th>
                <th>姓名</th>
                <th>手机号</th>
                <th>邮编</th>
                <th>会员id</th>
                <th>详细地址</th>
                <th>省代码</th>
                <th>市代码</th>
                <th>区代码</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="content">
            </tbody>
        </table>
        <div style="text-align: center" >
            <ul class="pagination" id="pagantion">

            </ul>
        </div>
    </div>
</div>
#end

#define bootStrapJs()

<script type="text/x-mustache" id="template">
     {{#items.list}}
            <tr id="item-{{id}}">
                <td>{{id}}</td>
                <td>{{create_time}}</td>
                <td>{{modify_time}}</td>
                <td>{{address}}</td>
                <td>{{province}}</td>
                <td>{{city}}</td>
                <td>{{area}}</td>
                <td>{{status}}</td>
                <td>{{is_default}}</td>
                <td>{{mobile}}</td>
                <td>{{name}}</td>
                <td>{{zip_code}}</td>
                <td>{{member_id}}</td>
                <td>{{area_detail}}</td>
                <td>{{province_code}}</td>
                <td>{{city_code}}</td>
                <td>{{area_code}}</td>
                <td>
                    <a href="javascript:;" class="delete-btn" data-id="{{id}}">删除</a>|
                    <a href="javascript:;" class="edit-btn" data-id="{{id}}">编辑</a>|
                </td>
            </tr>
    {{/items.list}}
</script>

<script>
    $(document).ready(function(){

        $("#searchBtn").click(function(){
            initData();
        });

        initData();

        function initData(){
            var setting = {
                "url":"#(contextPath)/travel/receiver/listAll",
                "data":{
                    "receiver.id":$("#id").val(),
                    "receiver.create_time":$("#create_time").val(),
                    "receiver.modify_time":$("#modify_time").val(),
                    "receiver.address":$("#address").val(),
                    "receiver.province":$("#province").val(),
                    "receiver.city":$("#city").val(),
                    "receiver.area":$("#area").val(),
                    "receiver.status":$("#status").val(),
                    "receiver.is_default":$("#is_default").val(),
                    "receiver.mobile":$("#mobile").val(),
                    "receiver.name":$("#name").val(),
                    "receiver.zip_code":$("#zip_code").val(),
                    "receiver.member_id":$("#member_id").val(),
                    "receiver.area_detail":$("#area_detail").val(),
                    "receiver.province_code":$("#province_code").val(),
                    "receiver.city_code":$("#city_code").val(),
                    "receiver.area_code":$("#area_code").val(),
                },
            }
            var page = new Pagenation(setting);
            page.init();
        }

        $("#content").on("click",".delete-btn",function(){
            var id = $(this).attr("data-id");
            layer.confirm('确定要进行当前操作？', {
                btn: ['确定','取消']
            }, function(){
                $.ajax({
                    url:"/travel/receiver/doDelete",
                    data:{id:id},
                    method:"post",
                    success:function(resp){
                        if(resp.result){
                            layer.msg(resp.data);
                            $("#item-"+id).remove();
                        }else{
                            layer.msg(resp.data);
                        }
                    }
                })
            }, function(){

            });
        });

        $("#content").on("click",".edit-btn",function(){
            var id = $(this).attr("data-id");
            layer.confirm('确定要进行当前操作？', {
                btn: ['确定','取消']
            }, function(){
                window.location.href="/travel/receiver/queryById?id="+id
            }, function(){

            });
        });


    })
</script>
#end